@echo off
setlocal
@REM 设置字体编码
chcp 65001

REM 设置远程服务器信息
set SERVER_USERNAME=root
set SERVER_IP=124.221.21.41
set SERVER_PORT=33322
set SERVER_TARGET_DIR=/docker/nginx/html/

echo [34m ">>>开始打包..."
call npm run build:prod
@REM echo [34m 开始压缩...
@REM echo [37m 
:: 用Winrar 压缩dist文件夹
@REM "C:\Program Files\WinRAR\Rar.exe" a -k -r -s -m1 "dist.rar" "dist/"
echo.
echo [32m 打包完成！
echo.
echo [34m ">>>上传远程服务..."
echo [37m 
:: scp 上传到服务器
"D:\software\openSSH\scp.exe" -P %SERVER_PORT% -r dist/* prod.sh %SERVER_USERNAME%@%SERVER_IP%:%SERVER_TARGET_DIR%
@REM echo [32m 上传成功!
@REM echo [37m  
:: ssh 远程执行服务器上的一个shell脚本
@REM "D:\software\openSSH\ssh.exe" -P %SERVER_PORT%  %SERVER_USERNAME%@%SERVER_IP% "sh /docker/nginx/html/prod.sh"
echo.
echo [32m 服务更新成功！
echo [37m 

endlocal
::pause
